package com.zhsm.fuxi.mvp.ui.dialog

import android.content.Context
import com.youth.banner.BannerConfig
import com.youth.banner.Transformer
import com.zhsm.fuxi.R
import com.zhsm.fuxi.base.BaseDialog
import com.zhsm.fuxi.utils.GlideImageLoader
import kotlinx.android.synthetic.main.dialog_show_pic.*
import org.jetbrains.anko.sdk25.coroutines.onClick

/**
 * Created by GuZhC on 2018/11/05.
 * describe:显示站点图片
 */
class ShowPicDialog(context: Context, datas: List<String>) : BaseDialog(context) {

    val datas = datas
    override fun getLayoutId(): Int {
        return R.layout.dialog_show_pic
    }

    override fun getGravity(): Int {
        return BaseDialog.GRAVITY_CENTER
    }

    override fun isCanceledOnTouchOutside(): Boolean {
        return true
    }

    override fun initView() {
        super.initView()
        banner.setBannerStyle(BannerConfig.NUM_INDICATOR)
        banner.setBannerAnimation(Transformer.DepthPage)
        banner.setImageLoader(GlideImageLoader())
        banner.setImages(datas)
        banner.start()
        dialogRoot.onClick { dismiss() }
    }
}